package com.carrey.cms_1811.entity;

import java.io.Serializable;
import java.util.Date;

import javax.validation.constraints.NotBlank;

import org.springframework.format.annotation.DateTimeFormat;

public class User implements Serializable{

	/**
	 * 	序列号
	 */
	private static final long serialVersionUID = -9218796765456659602L;
	
	private Integer id;
	@NotBlank(message = "用户名不能为空")
	private String username; // 用户名
	@NotBlank(message = "密码不能为空")
	private String password; // 密码
	
	// 数据库忽略字段
	private String authCode; // 验证码
	@NotBlank(message = "昵称不能为空")
	private String nickname; // 昵称
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	private Date birthday; // 生日
	private Integer gender; // 性别
	private Integer locked; 
	private Date created; 
	private Date updated; 
	private Integer role; 
	private String url; 
	
	// 访问者ip
	private String visitor;
	

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getAuthCode() {
		return authCode;
	}

	public void setAuthCode(String authCode) {
		this.authCode = authCode;
	}

	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}

	public Date getBirthday() {
		return birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	public Integer getGender() {
		return gender;
	}

	public void setGender(Integer gender) {
		this.gender = gender;
	}

	public Integer getLocked() {
		return locked;
	}

	public void setLocked(Integer locked) {
		this.locked = locked;
	}

	public Date getCreated() {
		return created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

	public Date getUpdated() {
		return updated;
	}

	public void setUpdated(Date updated) {
		this.updated = updated;
	}

	public Integer getRole() {
		return role;
	}

	public void setRole(Integer role) {
		this.role = role;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getVisitor() {
		return visitor;
	}

	public void setVisitor(String visitor) {
		this.visitor = visitor;
	}

	public User(Integer id, @NotBlank(message = "用户名不能为空") String username,
			@NotBlank(message = "密码不能为空") String password, String authCode,
			@NotBlank(message = "昵称不能为空") String nickname, Date birthday, Integer gender, Integer locked, Date created,
			Date updated, Integer role, String url, String visitor) {
		super();
		this.id = id;
		this.username = username;
		this.password = password;
		this.authCode = authCode;
		this.nickname = nickname;
		this.birthday = birthday;
		this.gender = gender;
		this.locked = locked;
		this.created = created;
		this.updated = updated;
		this.role = role;
		this.url = url;
		this.visitor = visitor;
	}

	public User() {
		super();
		// TODO Auto-generated constructor stub
	}

	@Override
	public String toString() {
		return "User [id=" + id + ", username=" + username + ", password=" + password + ", authCode=" + authCode
				+ ", nickname=" + nickname + ", birthday=" + birthday + ", gender=" + gender + ", locked=" + locked
				+ ", created=" + created + ", updated=" + updated + ", role=" + role + ", url=" + url + ", visitor="
				+ visitor + "]";
	}
	
	
}
